import request from '@/utils/request'
import { remoteRequest } from '@/utils/remote'

// 查询次生灾害隐患评估列表
export function listSecond(id) {
  return request({
    url: '/fxfzaqbz/data/getAllSecondDisasters?id=' + id,
    method: 'get',
  })
}
export function listSeconds(id) {
  return request({
    url: '/fxfzaqbz/data/getAllSecondDisastersTwo?id=' + id,
    method: 'get',
  })
}

// 查询次生灾害隐患评估详细
export function getSecond(id) {
  return request({
    url: '/fxfzaqbz/data/getSecondDisastersById?id=' + id,
    method: 'get'
  })
}

// 上传次生灾害隐患评估
export function uploadSecond(data) {
  return request({
    url: '/fxfzaqbz/data/saveSecondDisasters',
    method: 'post',
    data: data
  })
}

// 修改次生灾害隐患评估
export function updateSecond(data) {
  return request({
    url: '/fxfzaqbz/data/updateSecondDisasters',
    method: 'post',
    data: data
  })
}

// 删除次生灾害隐患评估
export function delSecond(id) {
  return request({
    url: '/fxfzaqbz/data/deleteSecondDisasters?id=' + id,
    method: 'post'
  })
}

// 生成按月统计
export function createMonFile(id) {
  return request({
    url: '/fxfzaqbz/data/getExcelByMouth?id=' + id,
    method: 'get',
  })
}

// 生成按区域统计
export function createAreaFile(id) {
  return request({
    url: '/fxfzaqbz/data/getExcelByArea?id=' + id,
    method: 'get',
  })
}

// 模板下载
export function downTemplate(name) {
  return request({
    url: '/fxfzaqbz/data/download?fileName=' + name,
    method: 'get',
  })
}

// 标题是否重复
export function titleCheck(data) {
  return remoteRequest('titleCheck', data, () => {
    return request({
      url: '/fxfzaqbz/data/secondDisastersIfRepetition',
      method: 'post',
      data: data
    })
  })
}

// 提交最终成果
export function firstSubmitDisasterAss(id) {
  return request({
    url: '/fxfzaqbz/data/firstSubmitSecondDisasters?id=' + id,
    method: 'post',
  })
}

// 提交
export function secondSubmitDisasterAss(ids) {
  return request({
    url: '/fxfzaqbz/data/secondSubmitSecondDisasters/' + ids,
    method: 'post',
  })
}

// 移除数据
export function removeDisasterAss(id) {
  return request({
    url: '/fxfzaqbz/data/removeSecondDisasters?id=' + id,
    method: 'post',
  })
}


// 编辑描述
export function updataDescribe(data) {
  return request({
    url: '/fxfzaqbz/data/addSecondDisastersDisaster',
    method: 'post',
    data: data
  })
}

// 查重
export function whatIsThisNumber(data) {
  return request({
    url: '/fxfzaqbz/data/whatIsThisNumber',
    method: 'post',
    data: data
  })
}

// 覆盖
export function coverRiskAssessment(data) {
  return request({
    url: '/fxfzaqbz/data/coverRiskAssessment',
    method: 'post',
    data: data
  })
}